package com.csair.seam.controller.pc;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.csair.seam.domain.model.entity.EquipOrg;
import com.csair.seam.domain.service.IEquipOrgService;
import com.csair.seam.infrastructure.web.BaseController;
import com.csair.seam.infrastructure.web.BaseResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(tags = "设备组织服务接口")
@RestController
@RequestMapping("/pc/org")
public class EquipOrgController extends BaseController {
    @Autowired
    private IEquipOrgService equipOrgService;

    @GetMapping("/list")
    @ApiOperation(value = "设备组织", notes = "查询与设备有关联的单位组织", httpMethod = "GET")
    public BaseResponse<List<EquipOrg>> getOrgList(){
        return buildSuccess(equipOrgService.findEquipOrgList());
    }
    
    @GetMapping("/depts/{orgId}")
    @ApiOperation(value = "根据组织id查找部门", notes = "findDeptListByOrgId", httpMethod = "GET")
    public BaseResponse<List<EquipOrg>> findDeptListByOrgId(@PathVariable String orgId){
        return buildSuccess(equipOrgService.findDeptListByOrgId(orgId));
    }
}
